package com.lovo;

import com.sun.source.doctree.SummaryTree;

public class Test {
    public static void main(String[] args) {
        int sum = 0;
        int comSum = 0;
        Computer computer = new Computer();
        Player player = new Player();

        System.out.println("游戏开始,请玩家出拳");
      while (true){
            player.getRadomNumber();
            int a = player.getNumber();
            System.out.println("电脑出拳");
            computer.getRadomNumber();
            int b = computer.getNumber();
            if (a==b) {
                sum++;
                player.setScore(sum);
                System.out.println("平局玩家加一分,现在玩家分数为"+player.getScore()+"电脑分数为："+computer.getScore());

            } else if (a == 1 && b == 2 || a == 2 && b == 3 || a == 3 && b == 1) {
                sum +=3;
                player.setScore(sum);
                System.out.println("本局玩家赢玩家加三分"+"现在玩家分数为"+player.getScore()+"电脑分数为："+computer.getScore());


            } else if (a == 1 && b == 3 || a == 2 && b == 1 || a == 3 && b == 2) {
                comSum += 3;
                computer.setScore(comSum);
                System.out.println("本局电脑获胜电脑加三分"+"现在玩家分数为"+player.getScore()+"电脑分数为："+computer.getScore());


            }
            if (sum >= 15) {
                System.out.println("玩家获胜");
                break;
            }
            if (comSum >= 15) {
                System.out.println("电脑获胜");
                break;
            }
        }
        System.out.println("最终得分：玩家"+player.getScore()+"电脑"+computer.getScore());

    }
}
